<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>易居</title>
    <link rel="stylesheet" href="../css/zlh_bootstrap.min.css">
    <link rel="stylesheet" href="../css/zlh_main.css">
</head>
<body>

<!--引入导航栏-->
<nav th:replace="~{topbar::top}"></nav>

<div class="container container-small">
    <h1>注册<label class="mytext">已有账号？<a href="/login_user">登录</a></label></h1>
    <form id="register" name="register" method="post" action="/user/register">
        <div class="form-group">
            <label>账号名称</label>
            <input name="account" type="text" class="form-control" required>
        </div>
        <div class="form-group">
            <label>真实姓名</label>
            <input name="userName" type="text" class="form-control" required>
        </div>
        <div class="form-group">
            <label>账号密码</label>
            <input name="password" type="password" class="form-control" min="6" max="18" required>
        </div>
        <div class="form-group">
            <label>手机号</label>
            <input name="telephone" type="text" class="form-control" required>
        </div>
        <div class="form-group">
            <label>邮箱</label>
            <input name="email" type="email" class="form-control" required>
        </div>
        <div class="form-group">
            <div class="form-group">
                <label>性别</label>
                <select name="sex" id="sex" class="form-control">
                    <option value="0">男</option>
                    <option value="1">女</option>
                </select>
            </div>
        </div>

        <div class="form-group">注册即代表您同意<a href="">易居网服务条款</a></div>
        <div class="form-group">
            <button class="btn btn-primary btn-block" type="submit" onclick="return check(this.form)">注册</button>
        </div>
    </form>
</div>
<div class="footer">© 2017 易居网 中国互联网举报中心京ICP证1401号京ICP备125439号-3京公网安备</div>
</body>
<script>

    function check(form) {
        var arg_check = {
            phone: form.telephone.value,
            password: form.password.value
        };

        if (arg_check.phone.length != 11) {
            alert("电话必须是11位");
            form.telephone.focus();
            return false;
        }
        if (arg_check.password.length < 8 || arg_check.password.length > 18) {
            alert("密码必须介于8-18位之间");
            form.password.focus();
            return false;
        }
        return true;
    }
</script>
</html>
